layui.use(['table', 'admin', 'ax','form'], function () {
    var $ = layui.$;
    var table = layui.table;
    var form = layui.form;
    var $ax = layui.ax;
    var admin = layui.admin;

    //获取详情信息，填充表单
    var ajax = new $ax(Feng.ctxPath + "/tDispatch/findorder?transportNumber=" + Feng.getUrlParam("transportNumber"));
    var result = ajax.start();
    form.val('orderTransportForm', result.data);

    /**
     * 货运订单明细表管理
     */
    var OrderTransportDetailed = {
        tableId: "orderTransportDetailedTable"
    };

    /**
     * 初始化表格的列
     */
    OrderTransportDetailed.initColumn = function () {
        return [[
            {field: 'goodsName', sort: true, title: '商品名称',width:270},
            {field: 'goodsNumber', sort: true, title: '商品编号', totalRowText: '合计：'},
            {field: 'goodsNo', sort: true, title: '货号'},
            {field: 'batchnumber', sort: true, title: '批次'},
            {field: 'num', sort: true, title: '数量', totalRow: true},
            {field: 'transportWeight', sort: true, title: '重量', totalRow: true},
            {field: 'transportPutvolume', sort: true, title: '体积', totalRow: true},
            {field: 'unitprice', sort: true, title: '单价'},
            {field: 'transportMoney', sort: true, title: '金额', totalRow: true},
            {field: 'largeclass', title: '商品大类'},
            {field: 'dpacking', title: '包装'},
            {field: 'goodsUnit', title: '单位'},
            {field: 'goodsSpecs', title: '规格'},
        ]];
    };

    // 渲染表格
    var tableResult = table.render({
        elem: '#' + OrderTransportDetailed.tableId,
        url: Feng.ctxPath + '/orderTransportDetailed/list?transportNumber='+$("#transportNumber").val(),
        page: true,
        limit: 40,
        height: 300,
        totalRow: true,
        cellMinWidth: 100,
        cols: OrderTransportDetailed.initColumn()
    });
});
